const TOKEN_KEY = 'token';
const NUMBER_KEY = 'number';
const USERNAME_KEY = 'username';

const isLogin = () => {
  return !!localStorage.getItem(TOKEN_KEY);
};

const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

const setToken = (token) => {
  localStorage.setItem(TOKEN_KEY, token);
};

const clearToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

const getNumber = () => {
  return localStorage.getItem(NUMBER_KEY);
};

const setNumber = (number) => {
  localStorage.setItem(NUMBER_KEY, number);
};

const getUsername = () => {
  return localStorage.getItem(USERNAME_KEY);
};

const setUsername = (username) => {
  localStorage.setItem(USERNAME_KEY, username);
};

export default { isLogin, getToken, setToken, clearToken, getNumber, setNumber, getUsername, setUsername };